-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add SofaRejectedExecutionHandler for user-customized thread pool #1450
Conversation
Hi @bohrqiu, welcome to SOFAStack community, Please sign Contributor License Agreement! After you signed CLA, we will automatically sync the status of this pull request in 3 minutes. |
WalkthroughThe changes involve modifications to the Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
core/api/src/test/java/com/alipay/sofa/rpc/config/UserThreadPoolManagerTest.java (2)
71-77
: LGTM: New test method added correctly.The
testRejectedExecutionHandler
method effectively verifies that theUserThreadPool
uses theSofaRejectedExecutionHandler
as intended. This aligns well with the PR objectives.Consider adding a brief comment explaining the purpose of this test for improved readability:
@Test public void testRejectedExecutionHandler(){ + // Verify that UserThreadPool uses SofaRejectedExecutionHandler UserThreadPool userThreadPool = new UserThreadPool(); Executor executorService = userThreadPool.getUserExecutor(); Assert.assertTrue(executorService instanceof ThreadPoolExecutor); Assert.assertTrue(((ThreadPoolExecutor) executorService).getRejectedExecutionHandler() instanceof SofaRejectedExecutionHandler); }
21-21
: Summary: Changes effectively implement and test the new feature.The addition of the
testRejectedExecutionHandler
method, along with the necessary import, successfully verifies the implementation ofSofaRejectedExecutionHandler
for user-customized thread pools. This change aligns well with the PR objectives and enhances the test coverage for theUserThreadPool
class.Consider adding similar tests for other types of user-customized thread pools, if applicable, to ensure comprehensive coverage of the new feature across different scenarios.
Also applies to: 71-77
core/api/src/main/java/com/alipay/sofa/rpc/server/UserThreadPool.java (1)
116-116
: LGTM! Consider adding import and updating documentation.The addition of
SofaRejectedExecutionHandler
aligns well with the PR objectives and enhances the exception handling for user-customized thread pools. This change is consistent with the existing code structure and doesn't affect the current functionality.Consider the following suggestions to improve the code further:
Ensure that the
SofaRejectedExecutionHandler
class is imported at the top of the file if not already present:import com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler;Update the method's documentation to reflect the new behavior:
/** * Builds and configures a ThreadPoolExecutor with custom settings. * * @return A configured Executor instance with SofaRejectedExecutionHandler */ protected Executor buildExecutor() { // ... existing code ... }These changes will improve code readability and maintainability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- core/api/src/main/java/com/alipay/sofa/rpc/server/UserThreadPool.java (1 hunks)
- core/api/src/test/java/com/alipay/sofa/rpc/config/UserThreadPoolManagerTest.java (2 hunks)
🔇 Additional comments (1)
core/api/src/test/java/com/alipay/sofa/rpc/config/UserThreadPoolManagerTest.java (1)
21-21
: LGTM: Import statement added correctly.The import for
SofaRejectedExecutionHandler
is necessary for the new test method and is placed appropriately with other imports.
|
@EvenLjj done |
@bohrqiu It's still the same problem. |
@EvenLjj oh sorry, i got it . i had format the code and run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Motivation:
The bizExecutor of all servers (TripleServer, httpServer, BoltServer) are configured with
SofaRejectedExecutionHandler
for exception handling and log processing, but the user-customized thread pool is missing.Summary by CodeRabbit
New Features
Tests